﻿using System;
using System.IO;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace PhotoManagerApp.Helpers
{
    public class ByteConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            byte[] byteBlob = value as byte[];
            MemoryStream ms = new MemoryStream(byteBlob);
            BitmapImage bmi = new BitmapImage();
            bmi.SetSource(ms);
            return bmi;
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}